using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public enum CharacterType{
    Saber,
    Archer,
    Mage
}
;
[CreateAssetMenu(fileName = "New Data", menuName = "Character Stats/Data")]
public class CharacterStats_SO : ScriptableObject
{
    [Header("Stats Info")] 
    public CharacterType characterType;
    public int maxHealth;
    public int currentHealth;
    public int baseDefence;
    public int currentDefence;

    [Header("Level")]
    public int currentLevel;
    public int maxLevel;
    public int baseExp;
    public int currentExp;
    public float levelBuff;
    
    [Header("Exp")]
    public int killPoint;

    public float levelMutiplier
    {
        get { return 1 + (currentLevel - 1) * levelBuff; }
    }
    public void updateExp(int point)
    {
        currentExp += point;

        if (currentExp >= baseExp)
        {
            LevelUp();
        }
    }

    private void LevelUp()
    {
        //所有升级后的属性变更
        currentLevel = Mathf.Clamp(currentLevel + 1, 0, maxLevel);
        baseExp += (int)(baseExp * levelMutiplier);
        maxHealth =(int)(maxHealth*levelMutiplier);
        currentHealth = maxHealth;
    }
}
